﻿// Dialog5_6.cpp: 实现文件
//

#include "pch.h"
#include "MFCGC.h"
#include "afxdialogex.h"
#include "Dialog5_6.h"
#include "MainFrm.h"

// Dialog5_6 对话框

IMPLEMENT_DYNAMIC(Dialog5_6, CDialogEx)

Dialog5_6::Dialog5_6(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG8, pParent)
	, X5_6_x1(80)
	, X5_6_y1(60)
	, X5_6_x2(500)
	, X5_6_y2(500)
{

}

Dialog5_6::~Dialog5_6()
{
}

void Dialog5_6::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, X5_6_x1);
	DDX_Text(pDX, IDC_EDIT7, X5_6_y1);
	DDX_Text(pDX, IDC_EDIT2, X5_6_x2);
	DDX_Text(pDX, IDC_EDIT3, X5_6_y2);
}


BEGIN_MESSAGE_MAP(Dialog5_6, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON2, &Dialog5_6::OnBnClickedButton2)
END_MESSAGE_MAP()


// Dialog5_6 消息处理程序


void Dialog5_6::OnBnClickedButton2()
{
	EndDialog(IDOK);// 关闭对话框
	// TODO: 绘制5-6
	CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
	UpdateData(1);

	if (pMainFrame) // 确保指针有效
	{
		// 修改 CMainFrame 中的 nowDraw p1 p2变量
		pMainFrame->nowDraw = 56;
		pMainFrame->x5_6p1 = CPoint(X5_6_x1,X5_6_y1);
		pMainFrame->x5_6p2 = CPoint(X5_6_x2,X5_6_y2);
		pMainFrame->Invalidate();

	}

}
